// with polyfills
// import 'babel-polyfill'
// import 'core-js/stable'
import 'core-js'
import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import moment from 'moment'
import i18n from './locales' // 国际化 中英文
// import { VueAxios } from './utils/request'
import themePluginConfig from '../config/themePluginConfig'
import { FormModel, Carousel, Transfer, Dropdown } from 'ant-design-vue'
import common from './components/index' // 全局注册组件
import { get, remove, post, put } from './utils/request'
import api from '@/api/materials' // 物资api
import * as flters from '@/api/filter' // 全局注册filters
import mixin from './utils/mixin' // 全局注册filters
import 'moment/locale/zh-cn'
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/pie'
import 'echarts/lib/component/tooltip'
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
// import './mock'
import './assets/public/common'
import './assets/public/technical.less'
import materialList from '@/components/materialList/materialList'
import supplierList from '@/components/supplierList/supplierList'
import axios from 'axios'
import MoreButton from '@/components/MoreButton'
import listStatus from '@/components/list_status/list_status'
import contractList from '@/components/contract_list/contract_list'
import personList from '@/components/person_list/person_list'
import orgList from '@/components/org_list/org_list'
import excel from '@/components/excel/excel'
import Print from 'vue-print-nb'
import BtnPermission from '@/core/directives/btnPermission'
import SelfBtn from '@/core/directives/selfBtn'
import SelfBtn2 from '@/core/directives/selfBtn2'
import InputLimit from '@/core/directives/inputLimit'
import StatusBtn from '@/core/directives/statusBtn'
// import QuillEditor from 'vue-quill-editor'
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
import BaseBreadcrumb from '@/components/BaseBreadcrumb'
import BaseInput from '@/components/BaseInput'
import BaseTextarea from '@/components/BaseTextarea'
import BaseInputNumber from '@/components/BaseInputNumber'
import OrgTreeSelect from '@/components/TreeSelect'
import UmyUi from 'umy-ui'
import 'umy-ui/lib/theme-chalk/index.css'
import VueClipboard from 'vue-clipboard2'
import filePreview from '@/utils/file-preview.js'
import disabledPermission from '@/utils/disabledPermission'
import BaseSvgIcon from '@/components/BaseSvgIcon'
import '@/assets/svg/index.js'
import '@/utils/decimalCalculation'
import gloabalMixins from '@/mixin/gloabalMixins'

Vue.component('OrgTreeSelect', OrgTreeSelect)
Vue.component('MoreButton', MoreButton)
import { setTableListTopNum } from "@/utils/util"
Vue.prototype.setTableListTopNum = setTableListTopNum
Vue.component(BaseSvgIcon.name, BaseSvgIcon)
Vue.use(VueClipboard)
Vue.use(UmyUi)
Vue.use(StatusBtn)
Vue.use(InputLimit)
Vue.use(SelfBtn)
Vue.use(SelfBtn2)
Vue.use(BtnPermission)
// Vue.use(QuillEditor)
Vue.use(Print)  //注册
// import VueHtml5Editor from 'vue-html5-editor'//富文本编辑器
// Vue.use(VueHtml5Editor);
// 原型注入方法
Vue.prototype.$$post = post
Vue.prototype.$$get = get
Vue.prototype.$$remove = remove
Vue.prototype.$$put = post // 只能用post方法
Vue.prototype.$$api = api
Vue.prototype.moment = moment
Vue.prototype.$axios = axios
Vue.prototype.$filePreview = filePreview
Vue.prototype.$disabledPermission = disabledPermission

Vue.prototype.$bus = new Vue()
// import bootstrap from './core/bootstrap'
import './core/lazy_use'
import './permission' // permission control
// import axios from  './utils/request' // global filter
import './assets/less/index.less'//导入，放在这个位置不要动，动了css不生效

// import echarts from 'echarts'
import * as echarts from 'echarts'
import initRichText from './assets/common/initHTMLEditor.js'

Vue.prototype.$echarts = echarts

Vue.config.productionTip = false
// 注入 全局 filters
Object.keys(flters).forEach(key => {
    Vue.filter(key, flters[key])
})
// mount axios to `Vue.$http` and `this.$http`
// Vue.use(VueAxios)
Vue.use(FormModel)
Vue.use(Carousel)
Vue.use(Transfer)
Vue.use(common)
Vue.use(Dropdown)

Vue.use(initRichText)
Vue.mixin(mixin)
Vue.mixin(gloabalMixins)
// Vue.component('pro-layout', ProLayout)
Vue.component('material-list', materialList)
Vue.component('supplier-list', supplierList)
Vue.component('list-status', listStatus)
Vue.component('contract-list', contractList)
Vue.component('person-list', personList)
Vue.component('org-list', orgList)
Vue.component('excel', excel)
Vue.component(BaseBreadcrumb.name, BaseBreadcrumb)
Vue.component(BaseInput.name, BaseInput)
Vue.component(BaseTextarea.name, BaseTextarea)
Vue.component(BaseInputNumber.name, BaseInputNumber)

window.umi_plugin_ant_themeVar = themePluginConfig.theme

//兼容原来tab的实现
Vue.prototype.$multiTab = {
    callbackFnMap: {}, // 回调映射表
    close() {
        Vue.prototype.$bus.$emit('close')
    },
    closePage(e) {
        Vue.prototype.$bus.$emit('closePage', e)
    },
    closeIframe(path) {
        Vue.prototype.$bus.$emit('closeIframe', path)
    },
    registerCallback(key, callback) {
        this.callbackFnMap[key] = callback
    },
    deleteCallback(key) {
        this.callbackFnMap[key] = null
        delete this.callbackFnMap[key]
    },
}

const vm = new Vue({
    router,
    store,
    i18n,
    // created: bootstrap,
    render: h => h(App)
}).$mount('#app')
export default vm
